<?php 
/**
 * 
 * Modelo de proseso outbound
 * @author Natanael
 * 
 */

class mprocesosoutbound extends Model{
	
	private $mTableName = "OB_ProcesosOutbound"; 
	
	public function __construct()
	{
		parent::Model();
	}
	
   public function loadProsesoOutbound($id) 
   {     
	   	  $result = $this->db->get_where($this->mTableName,array('idAfiliado'=>$id));
	   	  return $this->getArrayFromQueryResurt($result);
   }
   
	
   private function getArrayFromQueryResurt($result)
   {
	   	   if ($result->num_rows() == 0)
	   	      return false;
	   	      
	   	   $query_result = array();

	   	   foreach ($result->result() as $k)
	   	   {	
	   	   	   $query_result[] = new ProcesosOutboundS($k);
	   	   }
	   	   
	   	   return $query_result;
	 }
	 
  public function crearRegistro($data)
  {
  	
  	   if ($this->db->insert($this->mTableName,$data)) {
  	        return true;
  	   }
  	   
  	   return false;
  }

  public function loadLastProceso($idoutbound)
  {
  	    
  	     $result = $this->db->get_where($this->mTableName,array('idAfiliado'=>$idoutbound));
  	    
	   	 return $this->getArrayFromQueryResurt($result);
	     
  }
	
}

class ProcesosOutboundS{
	
	private $IdSOutbound = 0;
	private $IdAfiliado = 0; 
	private $FechaOutBound = " ";
	private $FechaSystema = " ";
	private $Contacto = " ";
	private $Comentario = " ";
	private $TipoOutbound = 0;
	private $ProximaLlamada = " ";

	public function __construct($ojt){
		
		$this->setIdSOutbound($ojt->idSOutbound);
		$this->setIdAfiliado($ojt->idAfiliado);
		$this->setFechaOutBound($ojt->fechaOutBound);
		$this->setFechaSystema($ojt->fechaSystema);
		$this->setContacto($ojt->Contacto);
		$this->setComentario($ojt->Comentario);
		$this->setTipoOutbound($ojt->tipoOutbound);
		$this->setProximaLlamada($ojt->proximaLlamada);
	}

	public function setIdSOutbound($ojt)
	{
		$this->IdSOutbound = $ojt;
	}
	
	public function getIdSOutbound()
	{
		return $this->IdSOutbound;
	}
	
	public function setIdAfiliado($ojt)
	{
		$this->IdAfiliado = $ojt;
	}
	
	public function getIdAfiliado()
	{
		return $this->IdAfiliado;
	}
	
	public function setFechaOutBound($ojt)
	{
		$this->FechaOutBound = $ojt;
	}
	
	public function getFechaOutBound()
	{
		return $this->FechaOutBound;
	}
	
	public function setFechaSystema($ojt)
	{
		$this->FechaSystema = $ojt;
	}
	
	public function getFechaSystema()
	{
	   return $this->FechaSystema;	
	}
	
	public function setContacto($ojt)
	{
		$this->Contacto = $ojt;
	}
	
	public function getContacto()
	{
		return $this->Contacto;
	}
	
	public function setComentario($ojt)
	{
		$this->Comentario = $ojt;
	}
	
	public function getComentario()
	{
		return $this->Comentario;
	}
	
	public function setTipoOutbound($ojt)
	{
		$this->TipoOutbound = $ojt;
	}
	
	public function getTipoOutbound()
	{
		return $this->TipoOutbound;
	}
	
	public function setProximaLlamada($ojt)
	{
		$this->ProximaLlamada = $ojt;
	}
	
	public function getProximaLlamada()
	{
		return $this->ProximaLlamada;
	}
}

?>